define("@widget/LAYOUT/bs-Search-Component-6b2b8cc5.js",["radpack","exports","~/c/bs-_rollupPluginBabelHelpers","~/c/bs-dataAids","~/c/bs-index","~/c/bs-searchFormLocations","~/c/bs-navigation","~/c/bs-PortalContainer"],(function(e,o,r,a,t,s,c,n){"use strict";class p extends(global.React||guac.react).Component{render(){const{staticContent:e,showSearch:o,onChange:r,uniqueId:t,searchQuery:c,formSubmit:n,searchFormLocation:p,onFocus:l}=this.props,i=p===s.D?"SearchPopout":p===s.N?"NavigationDrawer":void 0;return o&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Group.Form.Search,{section:"default",onSubmit:n},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Input.Search,{id:`${t}-input`,"data-aid":a.D.SEARCH_FIELD_RENDERED,onChange:e=>r({searchQuery:e.target.value}),value:c,autoComplete:"off","aria-autocomplete":"none",name:"keywords",placeholder:e.search_placeholder,"aria-label":e.search_placeholder,group:i,searchFormLocation:p,onFocus:l}))}}p.propTypes={staticContent:(global.PropTypes||guac["prop-types"]).object,showSearch:(global.PropTypes||guac["prop-types"]).bool,onChange:(global.PropTypes||guac["prop-types"]).func,uniqueId:(global.PropTypes||guac["prop-types"]).string,searchQuery:(global.PropTypes||guac["prop-types"]).string,formSubmit:(global.PropTypes||guac["prop-types"]).func,searchFormLocation:(global.PropTypes||guac["prop-types"]).string,onFocus:(global.PropTypes||guac["prop-types"]).func},p.defaultProps={staticContent:{},onChange:(global._||guac.lodash).noop,formSubmit:(global._||guac.lodash).noop};class l extends(global.React||guac.react).Component{render(){const{section:e,iconSection:o,styles:r,showSearch:s,onSearchOpenClick:n,onSearchClosedClick:p,inNavigationDrawer:l,iconStyles:i}=this.props,g={cursor:"pointer",position:"absolute",overflow:"visible",...l?{}:{left:"0px",top:"calc(50%)",transform:"translateY(-50%)","@md":{left:s?(t.S-parseFloat(t.I,10))/2+"px":"0px"}}};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Icon.Search,{icon:c.M,"data-aid":s?a.D.SEARCH_ICON_RENDERED_OPEN:a.D.SEARCH_ICON_RENDERED,onMouseUp:s?p:n,onTouchEnd:s?p:n,section:o||e,style:{...g,...s?{}:r,...i},size:t.I,minTarget:!s})}}function i(e){const{showSearch:o,sidebarWidth:r,renderForm:a,renderMagnifyIcon:s,renderCloseIcon:n}=e,p={icon:{pointerEvents:"none",opacity:.4},innerContainer:{zIndex:1,position:"absolute",left:0,width:t.M,transition:"width 0.3s",...o&&{display:"flex",justifyContent:"center",alignItems:"center",top:"medium",left:r-48,transform:"translateY(-50%)",paddingRight:r,width:"100vw",height:145,backgroundColor:"section"}},searchFormWrapper:{position:o?"relative":"unset",display:"flex",justifyContent:"space-between",alignItems:"center",width:"80%"}};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:p.container},o&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Icon,{icon:c.M,style:p.icon}),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:p.innerContainer,section:"default"},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:p.searchFormWrapper},a(),s(),n())))}l.propTypes={section:(global.PropTypes||guac["prop-types"]).string,iconSection:(global.PropTypes||guac["prop-types"]).string,styles:(global.PropTypes||guac["prop-types"]).object,showSearch:(global.PropTypes||guac["prop-types"]).bool,onSearchOpenClick:(global.PropTypes||guac["prop-types"]).func,inNavigationDrawer:(global.PropTypes||guac["prop-types"]).bool,onSearchClosedClick:(global.PropTypes||guac["prop-types"]).func,iconStyles:(global.PropTypes||guac["prop-types"]).object},l.defaultProps={styles:{},onSearchOpenClick:(global._||guac.lodash).noop,onSearchClosedClick:(global._||guac.lodash).noop},i.propTypes={showSearch:(global.PropTypes||guac["prop-types"]).bool,sidebarWidth:(global.PropTypes||guac["prop-types"]).number,renderForm:(global.PropTypes||guac["prop-types"]).func,renderMagnifyIcon:(global.PropTypes||guac["prop-types"]).func,renderCloseIcon:(global.PropTypes||guac["prop-types"]).func};const g={display:"flex",alignItems:"center"};class u extends(global.React||guac.react).Component{constructor(e){super(e),r._(this,"renderMagnifyIcon",(()=>{const{showSearch:e,section:o,iconSection:r,searchOpen:a,handleFormSubmit:t,iconStyles:s}=this.props;return(global.React||guac.react).createElement(l,{showSearch:e,section:o,iconSection:r,onSearchOpenClick:a,onSearchClosedClick:t,inNavigationDrawer:this.inNavigationDrawer,iconStyles:s})})),r._(this,"renderForm",(()=>{const{showSearch:e,staticContent:o,uniqueId:r,searchFormLocation:a,searchInputOnChange:t,searchQuery:s,handleFormSubmit:c,onFocus:n}=this.props;return(global.React||guac.react).createElement(p,{showSearch:e,staticContent:o,uniqueId:r,onChange:t,searchQuery:s,formSubmit:c,searchFormLocation:a,onFocus:n})})),r._(this,"renderCloseIcon",(()=>{const{showSearch:e,keepOpen:o,searchClose:r}=this.props,s={display:e&&!o?"block":"none",cursor:"pointer",right:"small",top:"small",marginLeft:"medium","@xs-only":{marginLeft:0,position:"fixed"}};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.CloseIcon,{onClick:r,style:s,"data-aid":a.D.SEARCH_CLOSE_RENDERED,size:t.I,minTarget:!0})}));const{searchFormLocation:o}=this.props;this.inNavigationDrawer=o===s.N}renderNavigationDrawerSearchContainer(){const{showSearch:e}=this.props,o={container:{...g,paddingVertical:"xsmall",width:e?"100%":t.M}};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:o.container},this.renderForm(),this.renderMagnifyIcon())}renderSidebarSearchContainer(){const{showSearch:e,sidebarWidth:o,uniqueId:r}=this.props;return(global.React||guac.react).createElement(i,{showSearch:e,uniqueId:r,sidebarWidth:o,renderForm:this.renderForm,renderMagnifyIcon:this.renderMagnifyIcon,renderCloseIcon:this.renderCloseIcon})}renderDesktopSearchContainer(){const{searchPosition:e,showSearch:o,showBackground:a,searchBgStyle:s,searchCategoryOverrides:c}=this.props,n="centered"===e||a,p={container:{...g,position:"absolute",zIndex:o?"1":"0",right:"0px",top:"50%",paddingVertical:o&&!n?"small":0,backgroundColor:o&&n?"section":"transparent",width:o?"calc(50vw - 80px)":t.M,transform:o&&"centered"===e?"translate(60%, -50%)":"translateY(-50%)",...o&&s},searchFormWrapper:{width:o?"100%":t.M}};let l;return c&&(l=o?c.openCategory:c.closeCategory),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:p.container},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,r.a({style:p.searchFormWrapper},c&&{category:l}),this.renderForm(),this.renderMagnifyIcon()),this.renderCloseIcon())}renderCoverSearchContainer(){const{searchPosition:e,showSearch:o,searchCategoryOverrides:a,formContainerId:s,onHomepage:c,hasNavBackground:p,section:l}=this.props,i={formWrapper:{display:o?"block":"none",zIndex:1,position:"absolute",right:"0px",top:"50%",width:"calc(50vw - 80px)",transform:"centered"===e?"translate(60%, -50%)":"translateY(-50%)"},navIcon:{width:t.M}},g={section:l};p||(c?g.category="neutral":g.section="alt"===l?"default":"alt"),a&&(g.category=a[o?"openCategory":"closeCategory"]);const u=(global.React||guac.react).createElement(n.P,{containerId:s},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:i.formWrapper},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Group.SearchPopout,r.a({},g,{hasBorder:p}),this.renderMagnifyIcon(),this.renderForm(),this.renderCloseIcon())));return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,null,(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:i.navIcon},this.renderMagnifyIcon()),u)}render(){const{searchFormLocation:e}=this.props;let o;switch(e){case s.N:o=this.renderNavigationDrawerSearchContainer();break;case s.S:o=this.renderSidebarSearchContainer();break;case s.D:o=this.renderCoverSearchContainer();break;default:o=this.renderDesktopSearchContainer()}return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{"data-aid":a.D.SEARCH_FORM_RENDERED,style:{width:e===s.N?"100%":t.M,...g,position:"relative"}},o)}}u.propTypes={isShopPage:(global.PropTypes||guac["prop-types"]).bool,shopPageId:(global.PropTypes||guac["prop-types"]).string,shopRoute:(global.PropTypes||guac["prop-types"]).string,searchPosition:(global.PropTypes||guac["prop-types"]).string,showBackground:(global.PropTypes||guac["prop-types"]).bool,keepOpen:(global.PropTypes||guac["prop-types"]).bool,domainName:(global.PropTypes||guac["prop-types"]).string,pageRoute:(global.PropTypes||guac["prop-types"]).string,showSearch:(global.PropTypes||guac["prop-types"]).bool,screenWidth:(global.PropTypes||guac["prop-types"]).number,searchQuery:(global.PropTypes||guac["prop-types"]).string,uniqueId:(global.PropTypes||guac["prop-types"]).string,searchClose:(global.PropTypes||guac["prop-types"]).func,staticContent:(global.PropTypes||guac["prop-types"]).object,handleFormSubmit:(global.PropTypes||guac["prop-types"]).func,searchInputOnChange:(global.PropTypes||guac["prop-types"]).func,iconSection:(global.PropTypes||guac["prop-types"]).string,color:(global.PropTypes||guac["prop-types"]).string,section:(global.PropTypes||guac["prop-types"]).string,searchOpen:(global.PropTypes||guac["prop-types"]).func,anchorId:(global.PropTypes||guac["prop-types"]).string,closeId:(global.PropTypes||guac["prop-types"]).string,searchFormLocation:(global.PropTypes||guac["prop-types"]).oneOf([s.a,s.D,s.N,s.S]),sidebarWidth:(global.PropTypes||guac["prop-types"]).number,searchBgStyle:(global.PropTypes||guac["prop-types"]).func,searchCategory:(global.PropTypes||guac["prop-types"]).string,searchCategoryOverrides:(global.PropTypes||guac["prop-types"]).object,iconStyles:(global.PropTypes||guac["prop-types"]).object,formContainerId:(global.PropTypes||guac["prop-types"]).string,onHomepage:(global.PropTypes||guac["prop-types"]).bool,hasNavBackground:(global.PropTypes||guac["prop-types"]).bool,navBarId:(global.PropTypes||guac["prop-types"]).string,onFocus:(global.PropTypes||guac["prop-types"]).func},u.defaultProps={searchPosition:"default",searchInputOnChange:(global._||guac.lodash).noop,searchClose:(global._||guac.lodash).noop,searchBackgroundStyle:{},iconStyles:{},shopRoute:""};var h={searchBgStyle:(global.PropTypes||guac["prop-types"]).func,searchPosition:(global.PropTypes||guac["prop-types"]).string,color:(global.PropTypes||guac["prop-types"]).string,isShopPage:(global.PropTypes||guac["prop-types"]).bool,shopPageId:(global.PropTypes||guac["prop-types"]).string,shopRoute:(global.PropTypes||guac["prop-types"]).string,iconSection:(global.PropTypes||guac["prop-types"]).string,inNavigationDrawer:(global.PropTypes||guac["prop-types"]).bool,staticContent:(global.PropTypes||guac["prop-types"]).object,renderMode:(global.PropTypes||guac["prop-types"]).string.isRequired,domainName:(global.PropTypes||guac["prop-types"]).string,pageRoute:(global.PropTypes||guac["prop-types"]).string,section:(global.PropTypes||guac["prop-types"]).string,keepOpen:(global.PropTypes||guac["prop-types"]).bool,searchFormLocation:(global.PropTypes||guac["prop-types"]).oneOf([s.M,s.a,s.N,s.S]),sidebarWidth:(global.PropTypes||guac["prop-types"]).number,searchCategoryOverrides:(global.PropTypes||guac["prop-types"]).object,iconStyles:(global.PropTypes||guac["prop-types"]).object,formContainerId:(global.PropTypes||guac["prop-types"]).string,navBarId:(global.PropTypes||guac["prop-types"]).string,membershipOn:(global.PropTypes||guac["prop-types"]).bool,onHomepage:(global.PropTypes||guac["prop-types"]).bool,hasNavBackground:(global.PropTypes||guac["prop-types"]).bool};class d extends(global.React||guac.react).Component{constructor(o){super(o),r._(this,"handleFormSubmit",(e=>{e.preventDefault();const{isShopPage:o,shopRoute:r,inNavigationDrawer:a}=this.props,{searchQuery:t}=this.state;if(!t)return;if(!this._olsCoreUtils)return void this._olsCorePromise&&this._olsCorePromise.then((()=>{this.handleFormSubmit(e)}));document.activeElement&&document.activeElement.blur&&document.activeElement.blur();const{OlsConfigStore:s,RouteHandler:n,ShopViewConstants:p,ScrollWidgetActions:l}=this._olsCoreUtils,i=s.getState().use_best_match;if(o&&!a){const e={keywords:t};i&&(e.sortOption="descend_by_match"),n.navigate(p.SEARCH_RESULTS,e),l.scrollShopWidget(),this.searchClose()}else{const e=i?"&sortOption=descend_by_match":"",o=`${c.S}&keywords=${encodeURIComponent(t)}${e}`;window.location.replace(`${r}?${o}`)}return!1})),r._(this,"handleFocus",(()=>{this._olsCorePromise||(this._olsCorePromise=new Promise((function(o,r){e.require(["@wsb/guac-widget-shared@^1/lib/common/ols-core/core-bundle"],o,r)})).then((e=>{let{OlsConfigStore:o,RouteHandler:r,ShopViewConstants:a,ScrollWidgetActions:t}=e;this._olsCoreUtils={OlsConfigStore:o,RouteHandler:r,ShopViewConstants:a,ScrollWidgetActions:t}})))})),r._(this,"searchOpen",(()=>{setTimeout((()=>{document.getElementById(`${this._uniqueId}-input`).focus()}),0),this.setState({showSearch:!0})})),r._(this,"searchClose",(()=>{this.setState({showSearch:!1,searchQuery:""})})),this._uniqueId=(global._||guac.lodash).uniqueId("Search"),this.state={searchQuery:"",showSearch:!1}}componentDidUpdate(){const{renderMode:e}=this.props,{showSearch:o}=this.state;e===(global.Core||guac["@wsb/guac-widget-core"]).constants.renderModes.EDIT&&!0===o&&this.searchClose()}renderSearchForm(){const{isShopPage:e,shopPageId:o,renderMode:r,searchPosition:a,searchBgStyle:t,inNavigationDrawer:s,domainName:c,pageRoute:n,staticContent:p,iconSection:l,section:i,keepOpen:g,searchFormLocation:h,sidebarWidth:d,searchCategoryOverrides:y,iconStyles:b,formContainerId:m,onHomepage:C,hasNavBackground:S,navBarId:P}=this.props,{showSearch:w,searchQuery:T}=this.state;return(global.React||guac.react).createElement(u,{isShopPage:e,shopPageId:o,renderMode:r,searchPosition:a,searchBgStyle:t,inNavigationDrawer:s,domainName:c,pageRoute:n,showSearch:w||g,searchQuery:T,uniqueId:this._uniqueId,searchClose:this.searchClose,staticContent:p,handleFormSubmit:this.handleFormSubmit,onFocus:this.handleFocus,searchInputOnChange:e=>this.setState(e),iconSection:l,section:i,searchOpen:this.searchOpen,searchFormLocation:h,sidebarWidth:d,searchCategoryOverrides:y,iconStyles:b,formContainerId:m,onHomepage:C,hasNavBackground:S,navBarId:P})}render(){return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{display:"flex",alignItems:"center"}},this.renderSearchForm())}}d.propTypes=h,d.defaultProps={keepOpen:!1,iconStyles:{}},o.default=d,Object.defineProperty(o,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-Search-Component-6b2b8cc5.js.map